{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. _nb_moead:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# MOEA/D\n",
    "\n",
    "\n",
    "This algorithm is implemented based on <cite data-cite=\"moead\"></cite>. The algorithm is based on [Reference Directions](../../misc/reference_directions.ipynb) which need to be provided when initializing the algorithm object."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from pymoo.algorithms.moo.moead import MOEAD\n",
    "from pymoo.optimize import minimize\n",
    "from pymoo.problems import get_problem\n",
    "from pymoo.util.ref_dirs import get_reference_directions\n",
    "from pymoo.visualization.scatter import Scatter\n",
    "\n",
    "problem = get_problem(\"dtlz2\")\n",
    "\n",
    "ref_dirs = get_reference_directions(\"uniform\", 3, n_partitions=12)\n",
    "\n",
    "algorithm = MOEAD(\n",
    "    ref_dirs,\n",
    "    n_neighbors=15,\n",
    "    prob_neighbor_mating=0.7,\n",
    ")\n",
    "\n",
    "res = minimize(problem,\n",
    "               algorithm,\n",
    "               ('n_gen', 200),\n",
    "               seed=1,\n",
    "               verbose=False)\n",
    "\n",
    "Scatter().add(res.F).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### API"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: pymoo.algorithms.moo.moead.MOEAD\n",
    "    :noindex:"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
